package com.cskaoyan.javse.oop3._2inner._4loacl._4life;

/**
 * @description: 生命周期
 * @author: wuguidong@cskaoyan.onaliyun.com
 **/

public class Demo {
    public static void main(String[] args) {
        EnclosedClazz ec = new EnclosedClazz();
        IA ia = ec.test();
        ia.method();
    }
}

class EnclosedClazz {
    public IA test() {
        int a = 10;
        class Inner implements IA {
            @Override
            public void method() {
                System.out.println(a);
                //a = 12;
            }
        }
        System.out.println(a);
        return new Inner();
    }
}

interface IA {
    void method();
}